allow decimal values to be shown on the peak graph (#1574)

Lloyd Pick 7 years ago
parent
commit
c3e263d3a4

+ 4 - 4
app/assets/stylesheets/agent_views/peak_detector_agent/show.css.scss

@@ -1,7 +1,7 @@
1 1
 .show-view.peak-detector-agent,
2 2
 .show-view.twitter-stream-agent {
3 3
   .rickshaw_annotation_timeline {
4
-    left: 40px;
4
+    left: 60px;
5 5
     width: 700px;
6 6
   }
7 7
 
@@ -28,7 +28,7 @@
28 28
 
29 29
       .chart {
30 30
         position: relative;
31
-        left: 40px;
31
+        left: 60px;
32 32
         overflow: hidden;
33 33
         width: 700px;
34 34
       }
@@ -60,8 +60,8 @@
60 60
         position: absolute;
61 61
         top: 0;
62 62
         bottom: 0;
63
-        width: 40px;
63
+        width: 60px;
64 64
       }
65 65
     }
66 66
   }
67
-}
67
+}

+ 2 - 2
app/views/agents/agent_views/peak_detector_agent/_show.html.erb

@@ -17,7 +17,7 @@
17 17
       <script>
18 18
         $(function() {
19 19
           var $chart = $(".chart-container.group-<%= index.to_s %>").last();
20
-          var data = <%= Utils.jsonify(data.map {|count, time| { :x => time.to_i, :y => count.to_i } }) %>;
20
+          var data = <%= Utils.jsonify(data.select {|c, _t| !c.nil? }.map {|count, time| { :x => time.to_i, :y => count.to_f } }) %>;
21 21
           var peaks = <%= Utils.jsonify((@agent.memory[:peaks] && @agent.memory[:peaks][group_name]) || []) %>;
22 22
           var name = <%= Utils.jsonify(group_name) %>;
23 23
 
@@ -30,4 +30,4 @@
30 30
   <p>
31 31
     No data has been received.
32 32
   </p>
33
-<% end %>
33
+<% end %>